<?php

class User_Form_ResetPassword extends Custom_Form
{

    public function init()
    {
		$translate = Zend_Registry::get('translate');
		$passwordConfirmation = new Custom_Validate_PasswordConfirmation();
		$this->setTranslator($translate);

        $this->setName("reset_password");
        $this->setMethod('post');

        $this->addElement('password', 'password', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', false, array(8, 50)),
				array('Alnum'),
			),
            'required'   => true,
            'label'      => __('New Password').':',
        ));

		$this->addElement('password', 'password_confirm', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', false, array(8, 50)),
				array('Alnum'),
				$passwordConfirmation
            ),
            'required'  => true,
			'ignore'	=> true,
            'label'     => __('Retype Password').':',
        ));

		$this->addElement('submit', 'save', array(
            'required' => false,
            'ignore'   => true,
            'label'    => __('Save'),
        ));

		$this->save->removeDecorator('label');

		$this->password->addErrorMessage('ERR_LOGIN_PASSWORD_REQUIRED');
		$this->password_confirm->addErrorMessage('ERR_INVALID_CONFIRM_PASSWORD');

		$this->loadFormClass();
    }
}

